import { Navigate } from 'dumi';
import React from 'react';
import { loginUrlKey } from '../src/utils/authentication';
import '../src/utils/injectWindow';

export const patchClientRoutes = ({ routes }: any) => {
  /**
   * redirect all legacy zh-CN routes to root
   */
  routes[0].children.push({
    id: 'zh-cn-redirect',
    path: 'zh-CN/*',
    element: <Navigate to="/" />,
  });

  // tokenHandle();
  // 设置默认登录地址
  window.localStorage.setItem(
    loginUrlKey,
    'http://cscf-login.tgsc81.com:30081',
  );

  return routes;
};
